#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
#include <QTextEdit>

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <sstream>

#include "traffic_sim.h"
#include "agent.h"

using namespace std;
using namespace Traffic_Sim;


class GraphWidget;
using namespace Traffic_Sim;

class Window : public QWidget
{
  Q_OBJECT

  QTextEdit *textout;
  
  public:
    Window();

    GraphWidget *get_GraphWidget(){
      return graphwidget;
    }
  

 public:
    Traffic_Graph * graph; 
    static GraphWidget * graphwidget;
    static Window * instance;
    bool paint;	

    public slots:
      void configure_traffic_graph();
    void start();
    void stop();
    void suspend();    
    void resume();
    void quit();
    void print_stream_out(const stringstream & strm);
 public:
    void create_street(const string & src_node_desc,
		       const string & dest_node_desc,
		       int delay, int capacity,
		       const string & street_name,
		       float src_x =0,
		       float src_y=0,
		       float dest_x=10,
		       float dest_y=10);

    void create_semaphore_agent(int id, const string & node_desc, int arc_count,  
				long activation_time, string* arc_nodes_desc );
    static void semaphore_update(void * semaphore_ptr);

    void program_agent_creation();
    static Traffic_Agent_Impl * create_vehicle(long id);

    static void assign_vehicle_renderer(Traffic_Agent_Impl * agent_impl);

    static void vehicle_situation(void * agent_impl);
};
 #endif
